package com.backend.demo.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.backend.demo.dao.PermissionDao;
import com.backend.demo.entities.Permission;
import com.backend.demo.service.IPermissionService;

/**
 * 权限service Impl
 * @author Administrator
 *
 */
@Service("permissionService")
public class PermissionServiceImpl implements IPermissionService {

	@Resource(name="permissionDao")
	private PermissionDao permissionDao;
	
	@Override
	public List<Permission> getAllPermissions() {
		return permissionDao.getPermissions();
	}

	@Override
	public List<Permission> getPermissionsByCondition(Permission permission) {
		return permissionDao.getPermissionByCondition(permission.getPermissionName(), permission.getCreatetime());
	}

	@Override
	public Permission getPermissionById(long permission) {
		return permissionDao.getPermissionById(permission);
	}

	@Override
	public int addPermission(Permission permission) {
		return permissionDao.addPermission(permission);
	}

	@Override
	public int editPermission(Permission permission) {
		return permissionDao.updatePermission(permission.getPermissionID(), permission.getPermissionName());
	}

	@Override
	public int deletePermission(Permission permission) {
		return permissionDao.delete(permission);
	}

}
